package main.com.service.Impl;

import main.com.dao.TextMapper;
import main.com.pojo.Text;
import main.com.service.TextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TextServiceImp implements TextService {

    @Autowired
    private TextMapper textMapper;

    @Override
    public int insert(Text text) {
        int insert = textMapper.insert(text);
        Integer id = text.getId();
        return id;
    }

    @Override
    public int delete(int id) {
        int i = textMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int update(Text text) {
        int i = textMapper.updateByPrimaryKey(text);
        return i;
    }

    @Override
    public List<Text> select() {
        List<Text> texts = textMapper.selectAll();
        return texts;
    }

    @Override
    public Text select(int id) {
        return textMapper.selectByPrimaryKey(id);
    }
}
